//
//  YNUserTreeRelation.h
//  Messenger
//
//  Created by OC on 15/1/15.
//  Copyright (c) 2015年 李健. All rights reserved.
//
//  用户组织机构关系实体类
//
#import <Foundation/Foundation.h>
#import "YNIMFrameworkTypedef.h"

@interface YNUserTreeRelation : NSObject

//userNo用户编号
@property (nonatomic, strong) NSString *userNo;

//orgNo组织机构ID
@property (nonatomic, strong) NSString *orgNo;

//relationType关系类型
@property (nonatomic, strong) NSString *relationType;

//排序号
@property (nonatomic) int ordId;

//removeTag删除标志
@property (nonatomic) int removeTag;



//创建用户与组织机构关系表
+ (BOOL)createInDatabase:(FMDatabase *)db;

//插入用户与组织机构关系信息
- (BOOL)insertInDatabase:(FMDatabase *)db;

//更新用户机构关系信息
- (BOOL)updateInDatabase:(FMDatabase *)db;

//判断用户机构关系是否存在
- (BOOL)isUserTreeRelationExistInDatabase:(FMDatabase *)db;

//删除表中所有数据
+ (BOOL)deleteAllUserTreeDataInDatabase:(FMDatabase *)db;

//2016-9-9jc修改，逻辑删除表中所有数据
+ (BOOL)logicDeleteAllUserTreeDataInDatabase:(FMDatabase *)db;

//根据orgNo查询直属User
+ (NSArray *)queryUserByOrgNo:(NSString *)orgNo database:(FMDatabase *)db;

//根据orgNo查询直属User，不包含老师
+ (NSArray *)queryUserNotTeacherByOrgNo:(NSString *)orgNo database:(FMDatabase *)db;



//根据orgNo查询下面的所有User对象 noTeacher:查询出的对象里是否不包含老师
+(NSArray *)queryAllUserByOrgNos:(NSString *)orgNos database:(FMDatabase *)db isNoTeacher:(BOOL)noTeacher;

//根据orgNo查询直属User数量
+(NSInteger)queryUserCountByOrgNos:(NSString *)orgNos database:(FMDatabase *)db;

//根据orgNo查询直属User在线人数数量
+(NSInteger)queryOnlineUserCountByOrgNos:(NSString *)orgNos database:(FMDatabase *)db;


//根据orgNo查询直属User数量,不包含老师信息
+(NSInteger)queryUserCountNotTeacherByOrgNos:(NSString *)orgNos database:(FMDatabase *)db;

//根据orgNo查询直属User在线人数数量,不包含老师信息
+(NSInteger)queryOnlineUserCountNotTeacherByOrgNos:(NSString *)orgNos database:(FMDatabase *)db;


@end
